

let http = require("http")   // es5  模块化暴露
// import http from "http"         // es6
let port = 3200
let hostname = "0.0.0.0"

var word = require("./module")
var { demo, msg, list } = require("./many")


var User = require("./user")
const ul = new User('xiaohan', 18, '我是神')

var Student = require("./student")

const sl = new Student("xiaoxiao", 22, "巴拉巴拉", 99)

// req 请求
// res 响应
const server = http.createServer((req, res) => {
    console.log(req.url);
    res.writeHead(200, { 'content-Type': 'text/html;charset=utf8' })
    res.write("<h2>武汉2110 -- day</h2>")

    res.write(`${word}`)

    res.write(`<h2>${demo}</h2>`)
    res.write(`<h2>${msg}</h2>`)
    res.write(`<h2>${list}</h2>`)

    res.write(`<h2>${ul.age}</h2>`)
    res.write(`<h2>${ul.say()}</h2>`)

    res.write(`<h2>${User.hobby}</h2>`)

    res.write(`<h2>${sl.age}</h2>`)
    res.write(`<h2>${sl.say()}</h2>`)
    res.write(`<h2>${Student.hobby}</h2>`)


    res.end()
}).listen(port, hostname, () => {
    console.log("my server is running at" + port);
})